package com.ytjj.qmyx.admin.controller.supplyChain;

import com.alibaba.fastjson.JSONObject;
import com.ytjj.common.utils.HttpClientUtil;
import com.ytjj.qmyx.admin.config.SupplyApiConfig;
import com.ytjj.qmyx.admin.model.request.StockWarningRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 库存预警
 */
@RestController
@RequestMapping("/stockWarning")
@Slf4j
public class StockWarningController {

    @Autowired
    private SupplyApiConfig supplyApiConfig;

    /**
     * 查询库存预警数据
     *
     * @return
     */
    @PostMapping("/list")
    public String list(@RequestBody StockWarningRequest request) {
        String s = HttpClientUtil.doPostJson(supplyApiConfig.getUrl() + "/stockWarning/list",
                JSONObject.toJSONString(request), supplyApiConfig.getHeadsMap());
        return s;
    }
}
